home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / Demos / AirHockey / cFade.cls < prev    next >
Encoding:
Visual Basic class definition  |  2001-10-08  |  1.6 KB  |  47 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "cFade"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. 'This is an 'effects' class, that will fade a scene in or out
  17. 'by increasing the alpha channel on all objects
  18. Public FadeInterval As Single
  19. Public AmFading As Boolean
  20. Public CanFade As Boolean
  21. Private mlPixelShaderHandle As Long
  22.  
  23. 'Methods used during fading
  24.  
  25. 'This will update the global params for fading the scene in, or out
  26. 'Fading is simply accomplished by adding or subtracting the amount of light in the scene until
  27. 'it reaches a desired level.  Since the background is black anyway, we could have also
  28. 'simply slowly turned up the alpha on each of the objects, this is just the way I chose.
  29. Public Sub Fade(ByVal nInterval As Long)
  30.     If Not CanFade Then Exit Sub
  31.     FadeInterval = nInterval
  32.     AmFading = True
  33. End Sub
  34.  
  35. Public Sub UpdateFade(oPuck As cPuck, oPaddle() As cPaddle, oTable As cTable, oRoom As cRoom)
  36.     Dim fDoneFading As Boolean
  37.     fDoneFading = True
  38.     fDoneFading = oPuck.FadeMesh(FadeInterval) And oPaddle(0).FadeMesh(FadeInterval) And oPaddle(1).FadeMesh(FadeInterval) And oTable.FadeMesh(FadeInterval) And oRoom.FadeMesh(FadeInterval)
  39.     AmFading = Not fDoneFading
  40. End Sub
  41.  
  42. Private Sub Class_Initialize()
  43.     'By default we will allow fading
  44.     CanFade = True
  45. End Sub
  46.  
  47.